package com.middlegroup.subjectpay.service.impl;

import com.middlegroup.subjectpay.entity.SubjectOutBills;
import com.middlegroup.subjectpay.mapper.SubjectOutBillsMapper;
import com.middlegroup.subjectpay.service.SubjectOutBillsService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 主体端出款订单表 服务实现类
 * </p>
 *
 * @author pc123
 * @since 2019-01-14
 */
@Service
public class SubjectOutBillsServiceImpl extends ServiceImpl<SubjectOutBillsMapper, SubjectOutBills> implements SubjectOutBillsService {

    @Resource
    SubjectOutBillsMapper subjectOutBillsMapper;

    @Override
    public SubjectOutBills getLastOneOutBills(SubjectOutBills subjectOutBills) {
        return subjectOutBillsMapper.getLastOneOutBills(subjectOutBills);
    }

    @Override
    public SubjectOutBills getLastOneOutByBillNo(String billNo, String merchantBillNo) {
        SubjectOutBills subjectOutBills = new SubjectOutBills();
        if (StringUtils.isNotBlank(billNo)) {
            subjectOutBills.setBillNo(billNo);
        }
        if (StringUtils.isNotBlank(merchantBillNo)) {
            subjectOutBills.setMerchantBillNo(merchantBillNo);
        }
        return subjectOutBillsMapper.getLastOneOutBills(subjectOutBills);
    }
}
